import { createRouter, createWebHashHistory } from 'vue-router'

// //导入组件
import LoginVue from '@/views/Login.vue'
import LayoutVue from '@/views/Layout.vue'
import HomeVue from '@/views/Home.vue'
import LocationVue from '@/views/Location.vue'
import ProvinceVue from '@/views/map/Province.vue'
import ShelterVue from '@/views/Shelter.vue'
import AnimalVue from '@/views/Animal.vue'
import UserAvatarVue from '@/views/user/UserAvatar.vue'
import UserInfoVue from '@/views/user/UserInfo.vue'
import UserResetPasswordVue from '@/views/user/UserResetPassword.vue'

//定义路由关系
const routes = [
    { path: '/login', component: LoginVue },
    {
        path: '/', component: LayoutVue, redirect: '/home', children: [
            { path: '/home', component: HomeVue },
            { path: '/location', component: LocationVue },
            { path: '/location/province', component: ProvinceVue,meta:{hidden:true} },
            { path: '/shelterForm', component: ShelterVue },
            { path: '/animalForm', component: AnimalVue },
            { path: '/user/info', component: UserInfoVue },
            { path: '/user/avatar', component: UserAvatarVue },
            { path: '/user/resetPassword', component: UserResetPasswordVue }
        ]
    }
]

//创建路由器
const router = createRouter({
    history: createWebHashHistory(),
    routes: routes
})

//导出路由
export default router
